package rpg.engine.model;

import java.util.ArrayList;
import java.util.List;

import rpg.client.model.Position;
import rpg.util.Objects;
import rpg.util.Strings;

public class MagicArea {
	public static class Builder {
		public Builder()  {
			super();
		}
		
		private Position from = Position.VOID;
		public Builder from(Position p)  {
			from = p;
			return this;
		}
		private Position to = Position.VOID;
		public Builder to(Position p)  {
			to = p;
			return this;
		}

		private String id = "";
		public Builder id(String s)  {
			id = s;
			return this;
		}
		
		private List<GameEffect> effects = new ArrayList<GameEffect>();
		public Builder effect(GameEffect e)  {
			effects.add(e);
			return this;
		}
		
		public MagicArea build()  {
			return new MagicArea(this);
		}
	}

	private final String id;
	public String getId()  {
		return id;
	}
	
	private Position from;
	public Position getFrom()  {
		return from;
	}
	
	private Position to;
	public Position getTo()  {
		return to;
	}
	
	private List<GameEffect> effects = new ArrayList<GameEffect>();
	public List<GameEffect> getEffects()  {
		return effects;
	}
	
	private MagicArea(Builder b)  {
		super();
		id = Strings.requireNonEmpty(b.id, "MagicArea.id");
		from = Objects.requireNonNull(b.from, "MagicArea.fromPosition");
		to = Objects.requireNonNull(b.to, "MagicArea.toPosition");
		effects.addAll(b.effects);
	}
}
